﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using ESRI.ArcGIS.Controls;
using SysCommon.Interface.BusinessGIS;
using AppCommon.Framework;

namespace TMSIM.Client.BizGIS.UI
{
    public partial class RCITS_MapToolsBizCtrl : GISCommon.RCITS_MapTools 
    {
        public RCITS_MapToolsBizCtrl()
        {
            InitializeComponent();

            IdentityClickIsAvailability = false;

            tsb_Identity.buttonBMPClick += new SysCommon.UI.ButtonBMPClick(tsb_Identity_buttonBMPClick);
                //menu_queryRoadInfo.Click += new EventHandler(menu_queryRoadInfo_Click);
            menu_QueryCarInfo.Click += new EventHandler(menu_QueryCarInfo_Click);
        }

        void tsb_Identity_buttonBMPClick(object sender, EventArgs e)
        {
            cm_Indicent.Show(tsb_Identity, 0, 26);
        }

        //IBGIS_IdentityBizCtrl m_SeletQueryRoad =
        //            (IBGIS_IdentityBizCtrl)SystemFactory.GetBizController(typeof(IBGIS_IdentityBizCtrl));
        void menu_QueryCarInfo_Click(object sender, EventArgs e)
        {
            Form tmpForm1 = null;
            Form tmpForm2 = null;
            foreach (Form form in Application.OpenForms)
            {
                if (form.Text == "道路属性信息")
                {
                    tmpForm1 = form;
                }
                if (form.Text == "车辆属性信息")
                {
                    tmpForm2 = form;
                }
            }

            if (tmpForm1 != null)
            {
                tmpForm1.Close();
                tmpForm1.Dispose();
            }
            if (tmpForm2 != null)
            {
                tmpForm2.Close();
                tmpForm2.Dispose();
            }
          
        }

        void menu_queryRoadInfo_Click(object sender, EventArgs e)
        {
            Form tmpForm1 = null;
            Form tmpForm2 = null;
            foreach (Form form in Application.OpenForms)
            {
                if (form.Text == "道路属性信息")
                {
                    tmpForm1 = form;
                }
                if (form.Text == "车辆属性信息")
                {
                    tmpForm2 = form;
                }
            }

            if (tmpForm1 != null)
            {
                tmpForm1.Close();
                tmpForm1.Dispose();
            }
            if (tmpForm2 != null)
            {
                tmpForm2.Close();
                tmpForm2.Dispose();
            }
       
        }

        private AxMapControl mMapControl;

        public void InitBiz(AxMapControl MapControl)
        {
            try
            {
                mMapControl = MapControl;
                init(MapControl);

                pic_Tools.Image = AppResources.Res.Resources.GetImage("tools.jpg");
                pic_Scale.Image = AppResources.Res.Resources.GetImage("map_sacle_text.jpg");

                tsb_Cancel.Image_A = AppResources.Res.Resources.GetImage("map_cancelselect_a.jpg");
                tsb_Cancel.Image_B = AppResources.Res.Resources.GetImage("map_cancelselect_b.jpg");
                tsb_Cancel.Image_C = AppResources.Res.Resources.GetImage("map_cancelselect_c.jpg");

                tsb_ZoomIn.Image_A = AppResources.Res.Resources.GetImage("map_zoomin_a.jpg");
                tsb_ZoomIn.Image_B = AppResources.Res.Resources.GetImage("map_zoomin_b.jpg");
                tsb_ZoomIn.Image_C = AppResources.Res.Resources.GetImage("map_zoomin_c.jpg");

                tsb_ZoomOut.Image_A = AppResources.Res.Resources.GetImage("map_zoomout_a.jpg");
                tsb_ZoomOut.Image_B = AppResources.Res.Resources.GetImage("map_zoomout_b.jpg");
                tsb_ZoomOut.Image_C = AppResources.Res.Resources.GetImage("map_zoomout_c.jpg");

                tsb_Pan.Image_A = AppResources.Res.Resources.GetImage("map_pan_a.jpg");
                tsb_Pan.Image_B = AppResources.Res.Resources.GetImage("map_pan_b.jpg");
                tsb_Pan.Image_C = AppResources.Res.Resources.GetImage("map_pan_c.jpg");

                tsb_FullExtent.Image_A = AppResources.Res.Resources.GetImage("map_showAll_a.jpg");
                tsb_FullExtent.Image_B = AppResources.Res.Resources.GetImage("map_showAll_b.jpg");
                tsb_FullExtent.Image_C = AppResources.Res.Resources.GetImage("map_showAll_c.jpg");

                tsb_PreView.Image_A = AppResources.Res.Resources.GetImage("map_prvView_a.jpg");
                tsb_PreView.Image_B = AppResources.Res.Resources.GetImage("map_prvView_b.jpg");
                tsb_PreView.Image_C = AppResources.Res.Resources.GetImage("map_prvView_c.jpg");

                tsb_NextView.Image_A = AppResources.Res.Resources.GetImage("map_NextView_a.jpg");
                tsb_NextView.Image_B = AppResources.Res.Resources.GetImage("map_NextView_b.jpg");
                tsb_NextView.Image_C = AppResources.Res.Resources.GetImage("map_NextView_c.jpg");

                tsb_Identity.Image_A = AppResources.Res.Resources.GetImage("Info_a.jpg");
                tsb_Identity.Image_B = AppResources.Res.Resources.GetImage("Info_b.jpg");
                tsb_Identity.Image_C = AppResources.Res.Resources.GetImage("Info_c.jpg");

                tsb_Find.Image_A = AppResources.Res.Resources.GetImage("map_Find_a.jpg");
                tsb_Find.Image_B = AppResources.Res.Resources.GetImage("map_Find_b.jpg");
                tsb_Find.Image_C = AppResources.Res.Resources.GetImage("map_Find_c.jpg");

                tsb_Measure.Image_A = AppResources.Res.Resources.GetImage("map_Rule_a.jpg");
                tsb_Measure.Image_B = AppResources.Res.Resources.GetImage("map_Rule_b.jpg");
                tsb_Measure.Image_C = AppResources.Res.Resources.GetImage("map_Rule_c.jpg");
            }
            catch(Exception ex)
            {
                SysCommon.Global.mainLog.Error("RCITS_MapToolsBizCtrl.InitBiz出错", ex);
            }
        }
    }
}
